package com.hjl.servlet;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author ServivE
 * @version 0.1
 * @className HelloServlet
 * @description
 * @date 2024/7/24 14:23
 * @since jdk11
 */
@WebServlet(name = "HelloServlet",urlPatterns = "/hello")
public class HelloServlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        //设置编码格式
        response.setContentType("text/html;charset=UTF-8");
        //创建out对象 对网页响应输出
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<head><title></title></head>");
        out.println("<body>");
        out.println("<font color='red'>萨瓦迪卡</font>");
        out.println("</body>");
        out.println("</html>");
    }

}
